module.exports = {
    //Provides any functions about mods
    modman: function(){
        
        this.modLoad = function(dir){
            fs.readdir(dir, function(err, files){
                for (i in files) {
                    var filename = files[i];
                    var filenameSplit = filename.split('.');
                    if (filenameSplit[filenameSplit.length - 1] == "js"){
                        var objectName = filename.substr(0, (filename.length - 3));
                        var mod = require(config.mods_dir+filename);
                        main.mods[objectName] = new mod[objectName]();
                        main.mods[objectName].init();
                    }
                }
            });
        };
        
        this.modExist = function(modname){
            if (main.mods[modname] != undefined && main.mods[modname].typeOf == "object")
                return true;
            else
                return false;
        };
        
        this.getMod = function(modname){
            if (this.modExist(modname))
                return main.mods[modName];
            else
                return false;
        };
    }
}